<template>
  <div class="">
    <!--核实整合-->
    <el-dialog class="m_dialog" :title="dialongTitle" :visible.sync="dialogVisible" width="800" append-to-body
      :before-close="cancel" :close-on-click-modal="false">
      <div class="content">
        <!-- 基础信息 -->
        <div class="content-box">
          <div class="box-heard">
            <CustomTitle title="基础信息"></CustomTitle>
          </div>
          <div class="box-body" style="min-height: 317px;">
            <BaseDescriptions :descConfig="descConfig" :descConfigItem="basisConfigItem" :descModel="descModel">
            </BaseDescriptions>
          </div>
        </div>
        <!-- 整改信息-->
        <div class="content-box">
          <div class="box-heard">
            <CustomTitle title="整改信息"></CustomTitle>

          </div>
          <div class="box-body" style="min-height: 317px;">
            <BaseDescriptions :descConfig="descConfig" :descConfigItem="rectificationConfigItem" :descModel="descModel">
            </BaseDescriptions>
          </div>
        </div>
        <!-- 验收结果 -->
        <div class="content-box">
          <div class="box-heard">
            <CustomTitle title="验收销案"></CustomTitle>
          </div>
          <div class="box-body" style="min-height: 317px;">
            <custom-form ref="form" :formModel="formModel" :formItemConfig="acceptanceConfigItem" :formRules="formRules"
              label-width="120px" label-position="left" />
          </div>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button v-show="qualified" @click="cancel" class="btn_cancel">返 回</el-button>
        <el-button  v-show="qualified" @click="cancel" class="btn_cancel">提交</el-button>
        <el-button v-show="unQualified" @click="cancel" class="btn_cancel">重新整改</el-button>
      </div>
    </el-dialog>
  </div>
</template>
      
<script>
import { mapState } from 'vuex';
import BaseDescriptions from '@/components/PageContent/BaseDescriptions.vue';
export default {
  name: 'operationDetail',
  props: {
    dialogVisible: {
      type: Boolean,
      default: false,
    },
    //   titleIndex: {
    //     type: Number | String,
    //     default: 0,
    //   },
    //   descData: {
    //     type: Object,
    //     default: () => {},
    //   },
    //   dictMap: {
    //     type: Object,
    //     default: () => {},
    //   },
  },
  data() {
    return {
      // 合格
      qualified:true,
      // 不合格
      unQualified:false,
      // 核实整改信息
      isRegistrationShow: true,
      // 整改信息和验收结果
      isOverruleINfoShow: false,
      // 驳回按钮显示
      isOverruleButtonShow: true,
      // 弹窗标题
      dialongTitle: "核实整改",
      descConfig: {
        size: 'medium',
        column: '2',
      },
      descModel: {
        infoId: '',
        userName: '',
        ipaddr: '',
        status: '',
        accessTime: '',
      },
      formModel:{},
      // 表单验证
      formRules: {
        deviceTypeKey: {
          required: true,
          message: "设备类型字符串",
          trigger: "blur",
        },
        deviceTypeName: {
          required: true,
          message: "类型名称不能为空",
          trigger: "blur",
        },
      },
      // 基础信息配置
      basisConfigItem: [
        {
          fieIdName: 'infoId',
          label: '隐患事项',
          span: 2,
        },
        {
          fieIdName: 'userName',
          label: '所属项目点位',
          span: 2,
        },
        {
          fieIdName: 'ipaddr',
          label: '发现人员',
          span: 2,
        },
        {
          fieIdName: 'status',
          label: '发现时间',
          span: 2,
          slotName: 'status',
        },
        {
          fieIdName: 'msg',
          label: '隐患内容',
          span: 2,
        },
        {
          fieIdName: 'accessTime',
          label: '隐患图片',
          component: 'BaseImages',
          span: 2,
        },
      ],
      // 整改信息配置
      rectificationConfigItem: [
        {
          fieIdName: 'infoId',
          label: '处理人员',
          span: 2,
        },
        {
          fieIdName: 'userName',
          label: '处理时间',
          span: 2,
        },
        {
          fieIdName: 'userName',
          label: '隐患类型',
          span: 2,
        },
        {
          fieIdName: 'userName',
          label: '整改内容',
          span: 2,
        },
        {
          fieIdName: 'ipaddr',
          label: '整改图片',
          component: 'BaseImages',
          span: 2,
        },
      ],
      // 验收结果配置
      acceptanceConfigItem: [
        {
          label: '状态',
          prop: 'dictState',
          component: "BaseRadioGroup",
          span: 12,
          width: '100%',
          options: [
            {
              label: '整改合格',
              value: '0',
            },
            {
              label: '重新整改',
              value: '1',
            }
          ],
          onChange:(e)=>{
            console.log(e)
            // console.log(this)
            this.formState(e)   
          }
        },
        {
          label: '验收备注',
          prop: 'deviceTypeName',
          span: 24,
          type: "textarea",
          clearable: true

        },
      ]
    }
  },
  computed: {
    ...mapState('dialog', ['dialogTitles']),
  },
  watch: {
    // descData: {
    //   deep: true,
    //   immediate: true,
    //   handler() {
    //     this.descModel = JSON.parse(JSON.stringify(this.descData));
    //   },
    // },
  },
  created() { },
  mounted() { },
  methods: {
    cancel() {
      this.$emit('cancel');
    },
    formState(e) {
     if(e=='0'){
      this.qualified = true
      this.unQualified = false
     }else{
      this.qualified = false
      this.unQualified = true
     }
    }
  },
  components: {
    BaseDescriptions,
  },
};
</script>
      
<style lang="less" scoped></style>
      